﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WordRacer.Domain.Model.GameCells
{
  public class GameCell 
  {
    public Guid UniqueID { get; set; }
    public String Character { get; set; }
    public bool InUse { get; set; }
    public IList<GameCell> ConnectedCells;
    public GameCell()
    {
      UniqueID = Guid.NewGuid();
      ConnectedCells = new List<GameCell>();
    }

    internal void AddCellConnection(GameCell cellToConnect)
    {
      if (!ConnectedCells.Contains(cellToConnect))
      {
          ConnectedCells.Add(cellToConnect);
      }
    }

    public override bool Equals(object obj)
    {
      var right = obj as GameCell;
      return ((this.GetType() == right.GetType()) &&  (this.UniqueID == right.UniqueID));
    }

    public override int GetHashCode()
    {
      return this.UniqueID.GetHashCode();
    }
  }
}
